#! /usr/local/bin/gosh

(use www.cgi)
(use www.contcgi)
(use text.html-lite)

(define (main args)
  (contcgi-main
   (lambda (params)
     (let* ((a (cgi-get-parameter "value"
				  (show `(,(cgi-header)
					  ,(html-doctype)
					  ,(html:html
					    (html:body
					     (html:p (html:b (format "pid = ~a" (sys-getpid))))
					     (html:p "? + ? = ?")
					     (html:p "input number")
					     (html:form
					      :method "GET" :action "./sum.fcgi"
					      (html:input :type "hidden" :name "cont-count" :value cont-count)
					      (html:input :type "text" :name "value")
					      (html:input :type "submit"))))))
				  :convert x->number))
	    (b	(cgi-get-parameter "value"
				   (show `(,(cgi-header)
					   ,(html-doctype)
					   ,(html:html
					     (html:body
					      (html:p (html:b (format "pid = ~a" (sys-getpid))))
					      (html:p (format #f "~a + ? = ?" a))
					      (html:p "input number")
					      (html:form
					       :method "GET" :action "./sum.fcgi"
					       (html:input :type "hidden" :name "cont-count" :value cont-count)
					       (html:input :type "text" :name "value")
					       (html:input :type "submit"))))))
				   :convert x->number)))
       (show `(,(cgi-header)
	       ,(html-doctype)
	       ,(html:html
		 (html:body
		  (html:p (html:b (format "pid = ~a" (sys-getpid))))
		  (html:p (format #f "~a + ~a = ~a" a b (+ a b)))))))))))

;; Local variables:
;; mode: scheme
;; end:
